package com.lzy.cloud.order.service.impl;

import com.lzy.cloud.order.dtos.OrderAssessDto;
import com.lzy.cloud.order.dtos.OrderInsuranceInfoDto;
import com.lzy.cloud.order.entity.OrderInsuranceInfo;
import com.lzy.cloud.order.mapper.OrderInsuranceInfoMapperExt;
import com.lzy.cloud.order.service.OrderInsuranceInfoService;
import com.lzy.framework.core.utils.DozerUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @description:订单保险
 * @author: liyun
 * @create: 2018-07-06 16:26
 */
@Service
public class OrderInsuranceInfoServiceImpl implements OrderInsuranceInfoService {
    @Autowired
    private OrderInsuranceInfoMapperExt orderInsuranceInfoMapperExt;

    @Override
    public OrderInsuranceInfoDto queryByOrderId(String orderId) {
        return orderInsuranceInfoMapperExt.queryByOrderId(orderId);
    }

    @Override
    public Long create(OrderInsuranceInfoDto orderInsuranceInfoDto) {
        OrderInsuranceInfo orderInsuranceHolder = DozerUtils.map(orderInsuranceInfoDto, OrderInsuranceInfo.class);
        return orderInsuranceInfoMapperExt.insertSelective(orderInsuranceHolder) > 0 ? orderInsuranceHolder.getId() : 0L;
    }
}
